<?php

namespace App\Console\Commands\WaiMai;

use App\Service\WaiMai\WaiMaiAnalysisBuildService;
use App\Service\WaiMai\WaiMaiAnalysisService;
use Illuminate\Console\Command;

class GenerateProvinceCityCoordinateCommand extends Command
{
    protected $signature   = 'waimai:generate-province-city-coordinate';
    protected $description = '生成省市区的外卖信息至oss';

    public function handle()
    {
        ini_set('memory_limit', '-1');

        // 测试环境不执行
        if (isTest() && time() > strtotime('2023-04-21')) {
            return;
        }

        (new WaiMaiAnalysisBuildService())->generateProvinceCityCoordinateOss();

        // 更新文件时间
        WaiMaiAnalysisBuildService::updateOssTimeKey();
    }
}
